<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="__PUBLIC__/font-awesome/css/font-awesome.min.css" media="all"/>
    <link rel="stylesheet" href="__CSS__/admin.css" media="all">
    <style type="text/css">

        /* tooltip */
        #tooltip {
            position: absolute;
            border: 1px solid #ccc;
            background: #333;
            padding: 2px;
            display: none;
            color: #fff;
        }
    </style>
</head>
<body style="padding:10px;">
<div class="tplay-body-div">
    <div class="layui-tab">
        <ul class="layui-tab-title">
            <li class="layui-this">会员列表</li>
        </ul>
    </div>
    <form class="layui-form serch" action="{:url('admin/user/index')}" method="post">
        <div class="layui-form-item" style="float: left;">
            <div class="layui-input-inline">
                <input type="text" name="nickname" id="nickname"  autocomplete="off"
                       placeholder="请输入用戶昵称"
                       class="layui-input layui-btn-sm">
            </div>
            <div class="layui-input-inline">
                <input type="text" name="phone" id="phone" autocomplete="off"
                       placeholder="请输入手机号"
                       class="layui-input layui-btn-sm">
            </div>
            <div class="layui-input-inline">
                <input type="text" name="pphone" id="pphone" autocomplete="off"
                       placeholder="请输入推荐人手机号"
                       class="layui-input layui-btn-sm">
            </div>
            <div class="layui-input-inline">
                <select name="type" id="type" autocomplete="off" class="layui-input layui-btn-sm" >
                    <option value="">未选择</option>
                    <option value="1">无效节点</option>
                    <option value="2">有效节点</option>
                </select>
            </div>
            

            <div class="layui-inline">
              <input type="text" class="layui-input test-item" placeholder="请选择开始时间" name="start" id="start">
            </div>
            <div class="layui-inline">
              <input type="text" class="layui-input test-item" placeholder="请选择结束时间" name="end" id="end">
            </div>

            <button class="layui-btn layui-btn-danger layui-btn-sm" lay-submit="" lay-filter="serch">立即提交</button>
        </div>

    </form>

    
    <table class="layui-table" lay-size="sm">
        <colgroup>
            
            <col width="auto">
            <col width="auto">
            <col width="auto">
            <col width="auto">
            <col width="auto">
            <col width="auto">
            <col width="auto">
            <col width="auto">
            <col width="auto">
            <col width="auto">
            <col width="auto">
            <col width="auto">
            <col width="auto">
        </colgroup>
        <thead>
        <tr>
            <th>ID</th>
            <th>手机号</th>
            <th>账号类型</th>
            <th>昵称</th>
            <th>真实姓名</th>
            <th>推荐人手机号</th>
            <th>推荐人</th>
            
            <th>钱包地址</th>
            <th>活动账户</th>
            <th>矿池</th>
            <th>节点状态</th>
            <th>添加时间</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        {foreach $data as $key=>$value}
        <tr>
            <td>{$value['id']}</td>
            <td>{$value['phone']}</td>
            <td>{$value['system']}</td>
            <td>{$value['nickname']}</td>
            <td>{$value['truename']}</td>
            <td>{$value['parent']}</td>
            <td>{$value['parent_name']}</td>
            
            <td>{$value['stack']}</td>
            <td>{$value['activity_pool']}</td>
            <td>{$value['pool']}</td>
            <td>{$value['type']}</td>
            <td>{$value['create_time']}</td>
            <td>{$value['operation']}</td>
        </tr>
        {/foreach}
        </tbody>
    </table>
    <div style="padding:0 20px;">{$data->render()}</div>
    <table class='layui-table' style="display:none;" id="order_detail">
    <tbody id="order_content">
        
    </tbody>
    </table>
    <!-- 用户详情 -->
    <div class="layui-table" id="user_detail" style="display:none;font-size:16px;padding:10px;">
        <table>
            <tr>
                <td>用户手机号：</td>
                <td class="detail_phone"></td>
            </tr>
            <tr>
                <td>昵称：</td>
                <td class="detail_nickname"></td>
            </tr>
            <tr>
                <td>真实姓名：</td>
                <td class="detail_truename"></td>
            </tr>
            <tr>
                <td>性别：</td>
                <td class="detail_sex"></td>
            </tr>
            <tr>
                <td>钱包地址：</td>
                <td class="detail_qrcode"></td>
            </tr>


            <tr>
                <td>活动账户：</td>
                <td class="detail_score"></td>
            </tr>
            <tr>
                <td>矿池：</td>
                <td class="detail_balance"></td>
            </tr>
            <tr>
                <td>注册时间：</td>
                <td class="detail_create_time"></td>
            </tr>
            <tr>
                <td>最近登录时间：</td>
                <td class="detail_update_time"></td>
            </tr>
        </table>
    </div>
    <div class="layui-table" id="recharge" style="display:none;font-size:16px;">
        <table>
            <tr>
                <td>充入矿池金额：</td>
                <td><input type="number" id="pool" autocomplete="off" placeholder="请输入矿池金额"class="layui-input layui-btn-sm">
                    <input type="hidden" id="idd" value="" autocomplete="off"> </td>
            </tr>
            
            <tr>
                <td colspan="2"><button class="layui-btn layui-btn-danger layui-btn-sm" type="button" onclick="recharges()">立即提交</button></td>
                
            </tr>
        </table>
    </div>
    {include file="public/foot"}



</div>
</body>
<script type="text/javascript">
var layer = layui.use('layer', function() {});
        //用户详情
        function user_detail(id){
            $.getJSON("/admin/user/detail", {'id' : id}, function(res){
                var user = res.user;
                user.sex = user.sex == 1?'男':'女';
                $('.detail_phone').text(user.phone);
                $('.detail_nickname').text(user.nickname);
                $('.detail_truename').text(user.truename?user.truename:'');
                $('.detail_sex').text(user.sex);
                $('.detail_qrcode').text(user.stack);
                $('.detail_score').text(user.activity_pool);
                $('.detail_balance').text(user.pool);
                $('.detail_create_time').text(user.create_time);
                $('.detail_update_time').text(user.update_time);
                //捕获页
                layer.open({
                    type: 1,
                    shade: false,
                    area: ['400px', '500px'], //宽高
                    title: '用户详情', //不显示标题
                    content: $('#user_detail'),
                });
            });
        }
        function childs(id){
            location.href = "/admin/user/index?pid="+id
        }
        function set_sys(id,type){
            layer.confirm('确认修改吗？', {
              btn: ['确认','取消'] //按钮
            }, function(){
                var sql = "update tplay_users set system="+type+" where id="+id;
                location.href = "/admin/user/setsql?sql="+sql;
            });
        }
        function recharges(){
            layer.confirm('确认充值吗？', {
              btn: ['确认','取消'] //按钮
            }, function(){
                var idd = $('#idd').val();
                var money = $('#pool').val();
                var sql = 'update tplay_users set `pool` = `pool`';
                location.href = "/admin/user/setsql1?sql="+sql+"&sql1="+money+" where `id`="+idd;
            });
        }
        function recharge(id) {
            layer.open({
                type: 1,
                shade: false,
                area: ['350px', '350px'], //宽高
                title: '充值', //不显示标题
                content: $('#recharge'),
                success:function() {
                    $('#idd').val(id);
                }
            });
        }
        layui.use('laydate', function(){
            var laydate = layui.laydate;
             lay('.test-item').each(function(){
                laydate.render({
                  elem: this
                  ,trigger: 'click',
                  type: 'datetime'
                });
              });
        });
       
    </script>
</html>
